#include <stdio.h>
int main()
{
    printf("请输入学生人数:");
    int n, count, s; /*count是防止出现错误数据*/
    scanf("%d", &n);
    int a[n] = {};
    count = n;
    float avg;
    int max, min;
    int no = 0;
    /*录入成绩*/
    for (int i = 0; i < count; i++)
    {
        printf("请输入学生成绩:");
        scanf("%d", &a[i]);
        if (a[i] <= 0 || a[i] >= 100)
        {
            printf("数据错误\n");
            count++;
            continue;
        }
        s = s + a[i];

        /*计算最大最小值*/
        max = a[0], min = a[0];
        for (int i = 0; i < n; i++)
        {
            if (max < a[i])
            {
                max = a[i];
            }
        }

        for (int i = 0; i < n; i++)
        {
            if (min > a[i])
            {
                min = a[i];
            }
        }
        /*计算不合格人数*/
        if (a[i] < 60)
        {
            no++;
        }
    }
    avg = s / n;

    int t = a[0];
    int i = 0;
    /*成绩排序*/
    printf("最高分是:%d\n", max);
    printf("最低分是：%d\n", min);
    printf("平均分是：%.2lf\n", avg);
    printf("不合格人数有%d人\n", no);
    printf("成绩排序:\n");
    for (int i = 0; i < n; i++)
    {
        if (t > a[i])
        {
            a[0] = a[i];
            a[i] = t;
        }
        printf("%d ", a[i]);
    }

    return 0;
}